using Microsoft.AspNetCore.Authorization;
using Terra.Core.Constants;

namespace Terra.Core.Security.Permissions;

/// <summary>
/// 权限验证特性
/// </summary>
public class PermissionAttribute : AuthorizeAttribute
{
    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="permissionCode">权限编码</param>
    public PermissionAttribute(string permissionCode) : base(SecurityConstants.PermissionPolicyName)
    {
        PermissionCode = permissionCode;
    }

    /// <summary>
    /// 权限编码
    /// </summary>
    public string PermissionCode { get; }
}